<template>
  <div>
    <TopFilter
      :list="topFilterList"
      :cols="3"
      @filterChange="changeHandle"
    ></TopFilter>

    <FilterTable
      ref="table"
      :columns="columns"
      :fetchapi="fetchApi"
      :params="fetchParams"
      :datakey="'records'"
      :onRowSelectChange="selectChangeHandle"
      :onColumnsChange="columns => this.columns = columns"
    >

    </FilterTable>
    <div style="height:47px;"></div>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right'
      }"
    >
      <el-button @click="closeDrawer(1)">关 闭</el-button>
      <el-button @click="closeDrawer(2)" type="primary">确 定</el-button>
    </div>
  </div>
</template>
<script>
export default {
  data(){
    return{
      topFilterList:this.createdFrom(),
      columns:this.createdTable(),
      fetchParams:{

      },
      fetchApi:()=>{},
    }
  },
  methods:{
    createdFrom(){
      return [
        {
          type: 'INPUT',
          label: '事业部',
          fieldName: 'syb',
          placeholder: '请选择',
        },
        {
          type: 'INPUT',
          label: '经销商代码',
          fieldName: 'jxsdm',
          placeholder: '请选择',
        },
        {
          type: 'INPUT',
          label: '经销商名称',
          fieldName: 'jxsmc',
          placeholder: '请选择',
        },
      ]
    },
    createdTable(){
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '公司名称',
          dataIndex: 'gsmc',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '经销商代码',
          dataIndex: 'jxsdm',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '经销商简称',
          dataIndex: 'jxsjc',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '经销商类型',
          dataIndex: 'jxslx',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '经销商级别',
          dataIndex: 'jxsjb',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '事业部',
          dataIndex: 'syb',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '省份',
          dataIndex: 'sf',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '城市',
          dataIndex: 'cs',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '县区',
          dataIndex: 'xq',
          sorter: true,
          filter: true,
          filterType: 'input',
        },
      ]
    },
    changeHandle(val){
      this.fetchParams=Object.assign({},this.fetchParams,val)
    },
    closeDrawer(type){

    },
    selectChangeHandle(val){

    }
  },

}
</script>
